package ar.edu.caece.compiler.grammar.factories;

import ar.edu.caece.compiler.grammar.AbstractTokenVisitorFactory;
import ar.edu.caece.compiler.grammar.TokenVisitor;

public class POSEXPRLLAMFactory extends AbstractTokenVisitorFactory {

	private static POSEXPRLLAMFactory INSTANCE;
	
	private POSEXPRLLAM1Factory posexprllam1Factory;
	private POSEXPRLLAM2Factory posexprllam2Factory;

	
	public static POSEXPRLLAMFactory getInstance() throws Exception {
		if(INSTANCE==null) INSTANCE = new POSEXPRLLAMFactory();
		return INSTANCE;
	}
	
	private Initializer initializer = new Initializer() {
		
		@Override
		public void init() throws Exception {
			initializer = NoOperationInitializer.getInstance();
			posexprllam1Factory = POSEXPRLLAM1Factory.getInstance();
			posexprllam2Factory = POSEXPRLLAM2Factory.getInstance();
		}
	};
	
	private POSEXPRLLAMFactory() throws Exception {

	}
	
	@Override
	public TokenVisitor makeChainedVisitor(
			final TokenVisitor siguiente) throws Exception {
		initializer.init();

		return posexprllam1Factory.makeChainedVisitor(posexprllam2Factory.makeChainedVisitor(siguiente));
	
	}
	@Override
	public TokenVisitor makeVisitor() throws Exception {
		initializer.init();

		return posexprllam1Factory.makeChainedVisitor(posexprllam2Factory.makeVisitor());
	}
	
	
}
